<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMessageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->text('body');
			/*
             *$table->integer('from_id')->unsigned();
             *$table->integer('to_id')->unsigned();
			 */
			$table->foreignId('from_id')->constrained('users')->onDelete('cascade');
			$table->foreignId('to_id')->constrained('users')->onDelete('cascade');
            $table->timestamps();
        });

		/*
         *Schema::table('messages', function(Blueprint $table){
         *});
		 */
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('messages');
    }
}
